﻿using Microsoft.Xna.Framework.Input;

namespace AutumnEngine.Modules
{
    /// <summary>
    /// Manages keyboard input.
    /// </summary>
    public class KeyboardInputModule : Module
    {
        KeyboardState currentState, lastState;
        public override void Create()
        {
            currentState = Keyboard.GetState();
            base.Create();
        }
        public bool IsKeyDown(Keys k)
        {
            return currentState.IsKeyDown(k);
        }
        public bool IsKeyTriggered(Keys k)
        {
            return currentState.IsKeyDown(k) && !lastState.IsKeyDown(k);
        }

        public override void Update()
        {
            lastState = currentState;
            currentState = Keyboard.GetState();
            base.Update();
        }
    }
}
